package simplefactory

type API interface {
	Say() string
}

type (
	defaultAPI struct{}
	foo        struct{}
	bar        struct{}
)

const (
	ParaFoo int = iota
	ParaBar
	ParaButt
)

func (f foo) Say() string        { return "foo is saying" }
func (b bar) Say() string        { return "bar is saying" }
func (d defaultAPI) Say() string { return "default is saying" }

func NewAPI(para int) API {
	if para == ParaFoo {
		return foo{}
	}
	if para == ParaBar {
		return bar{}
	}
	return defaultAPI{}
}
